package com.example.moblie2030606150cjk0507;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    private TextView tvMainTitle;
    private EditText edtMainname;
    private EditText edtMainpsw;
    private Button btnMainlogin;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        btnMainlogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, showDataActivity.class);

                intent.putExtra("userName", edtMainname.getText().toString().trim());

                Bundle bundle = new Bundle();
                bundle.putString("passWord", edtMainpsw.getText().toString().trim());
                intent.putExtras(bundle);
                startActivity(intent);
            }
        });
    }

    private void initView() {
        tvMainTitle = (TextView) findViewById(R.id.tvMainTitle);
        edtMainname = (EditText) findViewById(R.id.edtMainname);
        edtMainpsw = (EditText) findViewById(R.id.edtMainpsw);
        btnMainlogin = (Button) findViewById(R.id.btnMainlogin);
    }
}